function [algorithms, mos, ci95] = compute_mos_ci95_3gaussian()
%function [algorithms, mos, ci95] = compute_mos_ci95_3gaussian()
% 
% Computes the MOS and 95% confidence interval for the mean, using a sum of 3
% Gaussians model.
%
% For more details, see
% 
% F. Ribeiro, D. Florencio, C. Zhang and M. Seltzer, "crowdMOS: An Approach for
% Crowdsourcing Mean Opinion Score Studies", submitted to ICASSP 2011.

algorithms = loadcell('algorithms.txt', [char(9)], '"');

for i = 1:length(algorithms)
	algorithms{i} = strtrim(algorithms{i});
	scores{i} = load(sprintf('scores_%s.txt', algorithms{i}));
	scores{i}(scores{i} < 0) = NaN;
end

NALGORITHMS = length(algorithms);

%%%%%%%%%%%%%%%%%%%
% MOS per algorithm
%%%%%%%%%%%%%%%%%%%

mos  = zeros(1, NALGORITHMS);
ci95 = zeros(1, NALGORITHMS);
for i = 1:NALGORITHMS
	t = tinv(.5*(1 + .95), min(size(scores{i})) - 1);
%	t = 1.96;

	mos(1,i)  = nanmean(scores{i}(:));
	ci95(1,i) = t * sqrt(mos_variance(scores{i}));;

	fprintf('Algorithm %8s: mu = %.2f, CI = %.2f\n', algorithms{i}, mos(1,i), ci95(1,i));
end
fprintf('\n')

